//
//  HTTPTool.h
//  GuChat
//
//  Created by iBenz on 14-10-19.
//  Copyright (c) 2014年 Guzhi Tech. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFHTTPSessionManager.h>

@class FormData;

typedef void(^HTTPRequestHeader)(AFHTTPRequestSerializer *serializer);
typedef void(^HTTPComplete)(NSError *error, NSDictionary *response);

@interface HTTPTool : NSObject
// overide these two methods to set header fields
+ (void)dispatchHeaderFieldsOnce:(AFHTTPSessionManager *)manager;
+ (void)dispatchHeaderFields:(AFHTTPSessionManager *)manager;

+ (NSURLSessionDataTask *)GET:(NSString *)httpUrl parameters:(NSDictionary *)parameters complete:(HTTPComplete)complete;
+ (NSURLSessionDataTask *)POST:(NSString *)httpUrl parameters:(NSDictionary *)parameters formDatas:(NSArray<FormData*> *)formDatas complete:(HTTPComplete)complete;

@end

@interface FormData : NSObject
@property(nonatomic, strong) NSData *data;
@property(nonatomic, strong) NSString *name;
@property(nonatomic, strong) NSString *fileName;
@property(nonatomic, strong) NSString *mimeType;
@end
